﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace Simple.Repository.Migrations
{
    public partial class _19 : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropIndex(
                name: "idx_OrganizationId",
                table: "SysFileInfo");

            migrationBuilder.DeleteData(
                table: "SysOrganization",
                keyColumn: "Id",
                keyValue: new Guid("08da7e1c-95ee-4ba2-8226-ff1d286558bb"));

            migrationBuilder.DropColumn(
                name: "OrganizationId",
                table: "SysFileInfo");

            migrationBuilder.AddColumn<bool>(
                name: "IsPreset",
                table: "SysDictionaryItem",
                type: "tinyint(1)",
                nullable: false,
                defaultValue: false,
                comment: "是否系统预置");

            migrationBuilder.AddColumn<bool>(
                name: "IsPreset",
                table: "SysDictionary",
                type: "tinyint(1)",
                nullable: false,
                defaultValue: false,
                comment: "是否系统预置");

            migrationBuilder.UpdateData(
                table: "SysDictionary",
                keyColumn: "Id",
                keyValue: new Guid("08da7f55-9dd1-4d8c-8eff-6398d2b2cfee"),
                column: "IsPreset",
                value: true);

            migrationBuilder.UpdateData(
                table: "SysDictionary",
                keyColumn: "Id",
                keyValue: new Guid("08da7f8e-076f-4fc6-8ef7-f776c63bdb87"),
                column: "IsPreset",
                value: true);

            migrationBuilder.UpdateData(
                table: "SysDictionary",
                keyColumn: "Id",
                keyValue: new Guid("08da837b-d2e5-4456-8e8c-9f65ac9669e0"),
                column: "IsPreset",
                value: true);

            migrationBuilder.UpdateData(
                table: "SysDictionary",
                keyColumn: "Id",
                keyValue: new Guid("08da837c-3a8c-43e6-802a-148c713b642b"),
                column: "IsPreset",
                value: true);

            migrationBuilder.UpdateData(
                table: "SysDictionary",
                keyColumn: "Id",
                keyValue: new Guid("08da837c-4250-4b2f-8c9e-440af0dc8441"),
                column: "IsPreset",
                value: true);

            migrationBuilder.UpdateData(
                table: "SysDictionary",
                keyColumn: "Id",
                keyValue: new Guid("08da837c-854e-471a-8923-47cef82ea251"),
                column: "IsPreset",
                value: true);

            migrationBuilder.UpdateData(
                table: "SysDictionary",
                keyColumn: "Id",
                keyValue: new Guid("08da873d-a3d6-4cdc-8623-ec70bc54bd3b"),
                column: "IsPreset",
                value: true);

            migrationBuilder.UpdateData(
                table: "SysDictionary",
                keyColumn: "Id",
                keyValue: new Guid("08da9de1-43b7-4ab6-81a0-4de197655980"),
                column: "IsPreset",
                value: true);

            migrationBuilder.UpdateData(
                table: "SysDictionaryItem",
                keyColumn: "Id",
                keyValue: new Guid("08da7f7b-4b68-408b-8ead-32709a2d2e99"),
                column: "IsPreset",
                value: true);

            migrationBuilder.UpdateData(
                table: "SysDictionaryItem",
                keyColumn: "Id",
                keyValue: new Guid("08da7f8c-0172-4d3f-8d35-3970755675d0"),
                column: "IsPreset",
                value: true);

            migrationBuilder.UpdateData(
                table: "SysDictionaryItem",
                keyColumn: "Id",
                keyValue: new Guid("08da7f8f-0c7d-4f20-8b12-1f08d59265d8"),
                column: "IsPreset",
                value: true);

            migrationBuilder.UpdateData(
                table: "SysDictionaryItem",
                keyColumn: "Id",
                keyValue: new Guid("08da7f8f-1287-4676-8e0f-353356645345"),
                column: "IsPreset",
                value: true);

            migrationBuilder.UpdateData(
                table: "SysDictionaryItem",
                keyColumn: "Id",
                keyValue: new Guid("08da837b-d966-4068-8729-633d3a67e3cf"),
                column: "IsPreset",
                value: true);

            migrationBuilder.UpdateData(
                table: "SysDictionaryItem",
                keyColumn: "Id",
                keyValue: new Guid("08da837b-ddc6-41f5-84b0-ad06da753448"),
                column: "IsPreset",
                value: true);

            migrationBuilder.UpdateData(
                table: "SysDictionaryItem",
                keyColumn: "Id",
                keyValue: new Guid("08da837c-53c8-420e-8ba7-698d83fe7657"),
                column: "IsPreset",
                value: true);

            migrationBuilder.UpdateData(
                table: "SysDictionaryItem",
                keyColumn: "Id",
                keyValue: new Guid("08da837c-5a65-4cfa-8b2c-062e35e51454"),
                column: "IsPreset",
                value: true);

            migrationBuilder.UpdateData(
                table: "SysDictionaryItem",
                keyColumn: "Id",
                keyValue: new Guid("08da837c-69fd-415c-814f-71101cd72799"),
                column: "IsPreset",
                value: true);

            migrationBuilder.UpdateData(
                table: "SysDictionaryItem",
                keyColumn: "Id",
                keyValue: new Guid("08da837c-6e87-4731-8593-2edb59502c44"),
                column: "IsPreset",
                value: true);

            migrationBuilder.UpdateData(
                table: "SysDictionaryItem",
                keyColumn: "Id",
                keyValue: new Guid("08da837c-734e-4d2c-88ca-c18b0a044ad0"),
                column: "IsPreset",
                value: true);

            migrationBuilder.UpdateData(
                table: "SysDictionaryItem",
                keyColumn: "Id",
                keyValue: new Guid("08da837c-904e-42b5-80f2-4f73fd06cbbd"),
                column: "IsPreset",
                value: true);

            migrationBuilder.UpdateData(
                table: "SysDictionaryItem",
                keyColumn: "Id",
                keyValue: new Guid("08da837c-954b-4aef-8c2e-42d17a6e7df9"),
                column: "IsPreset",
                value: true);

            migrationBuilder.UpdateData(
                table: "SysDictionaryItem",
                keyColumn: "Id",
                keyValue: new Guid("08da837c-99ff-493e-8126-102b5c4a6b72"),
                column: "IsPreset",
                value: true);

            migrationBuilder.UpdateData(
                table: "SysDictionaryItem",
                keyColumn: "Id",
                keyValue: new Guid("08da837c-9da8-4c77-8c63-b5d82adbbffb"),
                column: "IsPreset",
                value: true);

            migrationBuilder.UpdateData(
                table: "SysDictionaryItem",
                keyColumn: "Id",
                keyValue: new Guid("08da873d-b07e-4d79-8afd-2dda57180791"),
                column: "IsPreset",
                value: true);

            migrationBuilder.UpdateData(
                table: "SysDictionaryItem",
                keyColumn: "Id",
                keyValue: new Guid("08da873d-b7e0-49dc-8b24-c62a89e8ec35"),
                column: "IsPreset",
                value: true);

            migrationBuilder.UpdateData(
                table: "SysDictionaryItem",
                keyColumn: "Id",
                keyValue: new Guid("08da873d-bd6d-497a-84d4-f3c108f79401"),
                column: "IsPreset",
                value: true);

            migrationBuilder.UpdateData(
                table: "SysDictionaryItem",
                keyColumn: "Id",
                keyValue: new Guid("08da873d-c267-4fd7-8524-fc325d9589e3"),
                column: "IsPreset",
                value: true);

            migrationBuilder.UpdateData(
                table: "SysDictionaryItem",
                keyColumn: "Id",
                keyValue: new Guid("08da873d-c68f-4198-86ff-24a0748a76eb"),
                column: "IsPreset",
                value: true);

            migrationBuilder.UpdateData(
                table: "SysDictionaryItem",
                keyColumn: "Id",
                keyValue: new Guid("08da9de1-43b7-4c3b-8fc4-64e6ced7330a"),
                column: "IsPreset",
                value: true);

            migrationBuilder.UpdateData(
                table: "SysDictionaryItem",
                keyColumn: "Id",
                keyValue: new Guid("08da9de1-43b7-4c53-8a65-f2ef5168f0b1"),
                column: "IsPreset",
                value: true);

            migrationBuilder.UpdateData(
                table: "SysOrganization",
                keyColumn: "Id",
                keyValue: new Guid("08da7df0-d44a-4332-8a5c-7921cdc25450"),
                column: "Name",
                value: "默认机构");

            migrationBuilder.UpdateData(
                table: "SysPosition",
                keyColumn: "Id",
                keyValue: new Guid("08da7eb0-c4a6-4bd5-81da-9698273a18ea"),
                columns: new[] { "Name", "Remark" },
                values: new object[] { "默认职位", "默认职位" });

            migrationBuilder.UpdateData(
                table: "SysUser",
                keyColumn: "Id",
                keyValue: new Guid("08da8454-bc92-4590-8d28-b1034e400e1e"),
                columns: new[] { "OrganizationId", "PositionId" },
                values: new object[] { new Guid("08da7df0-d44a-4332-8a5c-7921cdc25450"), new Guid("08da7eb0-c4a6-4bd5-81da-9698273a18ea") });
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropColumn(
                name: "IsPreset",
                table: "SysDictionaryItem");

            migrationBuilder.DropColumn(
                name: "IsPreset",
                table: "SysDictionary");

            migrationBuilder.AddColumn<Guid>(
                name: "OrganizationId",
                table: "SysFileInfo",
                type: "char(36)",
                nullable: true,
                comment: "机构Id",
                collation: "ascii_general_ci");

            migrationBuilder.UpdateData(
                table: "SysOrganization",
                keyColumn: "Id",
                keyValue: new Guid("08da7df0-d44a-4332-8a5c-7921cdc25450"),
                column: "Name",
                value: "测试公司1");

            migrationBuilder.InsertData(
                table: "SysOrganization",
                columns: new[] { "Id", "Code", "CreatedTime", "CreatedUserId", "IsDeleted", "IsEnabled", "Name", "ParentId", "Remark", "Sort", "UpdatedTime", "UpdatedUserId" },
                values: new object[] { new Guid("08da7e1c-95ee-4ba2-8226-ff1d286558bb"), "org1-1", null, null, false, true, "测试部门1-1", new Guid("08da7df0-d44a-4332-8a5c-7921cdc25450"), null, 100, null, null });

            migrationBuilder.UpdateData(
                table: "SysPosition",
                keyColumn: "Id",
                keyValue: new Guid("08da7eb0-c4a6-4bd5-81da-9698273a18ea"),
                columns: new[] { "Name", "Remark" },
                values: new object[] { "测试岗位1", "测试岗位1" });

            migrationBuilder.UpdateData(
                table: "SysUser",
                keyColumn: "Id",
                keyValue: new Guid("08da8454-bc92-4590-8d28-b1034e400e1e"),
                columns: new[] { "OrganizationId", "PositionId" },
                values: new object[] { null, null });

            migrationBuilder.CreateIndex(
                name: "idx_OrganizationId",
                table: "SysFileInfo",
                column: "OrganizationId");
        }
    }
}
